<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed to fetch files with multiple extensions, excluding those located on the C Drive
 #   Configuration Type - COMPUTER
 #   Note: The Extension need to be hardcoded instead of *.exe, *.msi
#>

# Get all drives except C
$drives = Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Name -ne 'C' }

# Initialize an array to hold the results
$results = @()

# Loop through each drive and search for .exe and .msi files
foreach ($drive in $drives) {
    $path = $drive.Root
    try {
        $files = Get-ChildItem -Path $path -Include *.exe, *.msi -Recurse -ErrorAction SilentlyContinue  #The values need to be hardcoded here
        $results += $files
    } catch {
        Write-Host "Error accessing $path : $_"
    }
}

# Output results
if ($results.Count -gt 0) {
    $results | Select-Object FullName, Length, LastWriteTime
} else {
    Write-Host "No files found in drives other than C."
}